-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[Unify CustomOp Headerfile] Inference headerfile includes paddle/extension.h #51745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Unify CustomOp Headerfile] Inference headerfile includes paddle/extension.h #51745
Conversation
99fc873
to
a3ce6e9
Compare
@@ -51,3 +51,6 @@ phi_header_path_compat( | |||
file(RENAME | |||
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/extension.h | |||
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/ext_all.h) | |||
# Included header file of training and inference can be unified as single file: paddle/extension.h | |||
file(COPY ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/ext_all.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ext_all.h的内容:
15 #pragma once
16
17 // All paddle apis in C++ frontend
18 #include "paddle/include/experimental/phi/api/all.h"
19 // Python bindings for the C++ frontend
20 #ifndef PADDLE_ON_INFERENCE
21 #include "paddle/include/experimental/utils/pybind.h"
22 #endif
这里的相对路径关系不影响吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的路径关系是正确的,不会影响,并且需要引用的也是 ext_all.h
中的相对路径~
原来用户需要引用的头文件是 paddle/include/experimental/ext_all.h
,现在把这个文件拷贝到 ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/extension.h
,相当于用户引用的头文件变成了 paddle/extension.h
,从而达成自定义算子下,训练和推理引用头文件一致的效果。用户不需要做源码改动,提高易用性。
@@ -51,3 +51,6 @@ phi_header_path_compat( | |||
file(RENAME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前experimental下的不需要删除吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
出于兼容性的考虑,之前 experimental 下的应该删不掉~
PR types
Function optimization
PR changes
Others
Describe
Pcard-66988
随着 phi 的规范化程度不断提高,一些具有“experimental”的标识可以考虑移除。
用户在使用自定义算子做推理时,需要替换引入的头文件,本 PR 在保证兼容性的前提下,将
paddle/extension.h
头文件也拷贝到推理目录下,使得用户在推理场景下使用自定义算子时,不需要做源码改动。As the standardization of phi continues to increase, some flags with "experimental" may be considered for removal.
Users must substitute the header file to
include/experimental/ext_all.h
when using the custom operators in the inference scenario. Under the premise of ensuring compatibility, this PR copies thepaddle/extension.h
header file into the inference directory so that users do not need to change the source file when they use custom operators under inference scenario.